package io.jee.caisan.weixin.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import io.jee.caisan.weixin.utils.PageTools;

@Controller
@RequestMapping("/wechat")
public class CommonController {

	@GetMapping("/success")
	public String success(Model model, HttpServletRequest request, String url, String msg, Boolean back, Integer time) {
		if(time == null) {
			time = 0;
		}
		if(back == null) {
			back = false;
		}
		return PageTools.toSuccess(model, msg, url, back, time);
	}
	
	@GetMapping("/error")
	public String error(Model model, HttpServletRequest request, String url, String msg, Boolean back, Integer time) {
		if(time == null) {
			time = 0;
		}
		if(back == null) {
			back = false;
		}
		return PageTools.toError(model, msg, url, back, time);
	}
}
